package com.example.project.controller;

import com.example.project.entity.Aggregation;
import com.example.project.entity.Product;
import com.example.project.entity.RequestInto;
import com.example.project.entity.ResponseInfo;
import com.example.project.service.AggregationService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

//6.1.库存汇总
@RestController
@RequestMapping("/aggregation")
public class AggregationController {

    @Resource
    AggregationService aggregationService;

    //库存汇总表单
    @RequestMapping("/aggregationtable")
    public ResponseInfo aggregationtable(Aggregation aggregation, RequestInto params) {
        ResponseInfo res = aggregationService.aggregationtable(aggregation, params);

        return res;
    }

    //获取角色
    @RequestMapping("/aggregationrole")
    public ResponseInfo aggregationrole(String token) {
        ResponseInfo res = aggregationService.aggregationrole(token);
        return res;
    }

    //获取管理员
    @RequestMapping("/getadmin")
    public ResponseInfo getadmin() {
        ResponseInfo res = aggregationService.getadmin();
        return res;
    }

    //添加到库存汇总
    @RequestMapping("/addprodectorder")
    public ResponseInfo addprodectorder(Aggregation aggregation) {
        ResponseInfo res = aggregationService.addprodectorder(aggregation);
        return res;
    }

    //出库单表单
    @RequestMapping("/outboundtable")
    public ResponseInfo outboundtable(String id, RequestInto params) {
        ResponseInfo res = aggregationService.outboundtable(id, params);
        return res;
    }

    //    撤销删除出库表数据
    @RequestMapping("/deloutbound")
    public ResponseInfo deloutbound(String id) {
        ResponseInfo res = aggregationService.deloutbound(id);
        return res;
    }

    //修改出库表单数据
    @RequestMapping("/editoutbound")
    public ResponseInfo editoutbound(Aggregation aggregation) {
        System.out.println(aggregation);
        ResponseInfo res = aggregationService.editoutbound(aggregation);
        System.out.println(res);
        return res;
    }

    //入库单表单
    @RequestMapping("/warehousingtable")
    public ResponseInfo warehousingtable(String id, RequestInto params) {
        ResponseInfo res = aggregationService.warehousingtable(id, params);
        return res;
    }

    //    撤销删除入库表数据
    @RequestMapping("/delwarehousing")
    public ResponseInfo delwarehousing(String id) {
        ResponseInfo res = aggregationService.delwarehousing(id);
        return res;
    }

    //修改入库表单数据
    @RequestMapping("/editwarehousing")
    public ResponseInfo editwarehousing(Aggregation aggregation) {
        System.out.println(aggregation);
        ResponseInfo res = aggregationService.editwarehousing(aggregation);
        System.out.println(res);
        return res;
    }

//单据审核
//单据表单
@RequestMapping("/documenttable")
public ResponseInfo documenttable(Aggregation aggregation, RequestInto params) {
    ResponseInfo res = aggregationService.documenttable(aggregation, params);
    return res;
}
//通过入库单
@RequestMapping("/passproduct")
public ResponseInfo passproduct(Aggregation aggregation, Product product) {
    ResponseInfo res = aggregationService.passproduct(aggregation,product);
    return res;
}
//出库单
@RequestMapping("/rejectproduct")
public ResponseInfo rejectproduct(Aggregation aggregation, Product product) {
    ResponseInfo res = aggregationService.rejectproduct(aggregation,product);
    return res;
}
//驳回原因
@RequestMapping("/rejectreasonproduct")
public ResponseInfo rejectreasonproduct(Aggregation aggregation) {
    ResponseInfo res = aggregationService.rejectreasonproduct(aggregation);
    return res;
}
}
